<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>药品管理</title>
<link rel="stylesheet" type="text/css" href="/Weixin1/manage/css/css.css" />
<script type="text/javascript" src="/Weixin1/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="/Weixin1/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/Weixin1/js/jquery.form.js"></script>

<style>
.button {
    background-color: #008CBA;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 8px;
}
.greenbutton {
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 3% 4%;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 12px;
    border-radius: 8px;
}
</style>
</head>

<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="/Weixin1/manage/img/coin02.png" /><span><a href="#">首页</a>&nbsp;-&nbsp;<a
					href="#">公共管理</a>&nbsp;-</span>&nbsp;药品管理
			</div>
		</div>
		<div class="page">
			<!-- banner页面样式 -->
			<div class="banner">
				<div class="add">
					<a class="addA" href="/Weixin1/manage/medicineEdit/add">添加药品&nbsp;&nbsp;+</a>
				</div>
			
				<!-- banner 表格 显示 -->
				<div >
					<table border="1" cellspacing="0" cellpadding="0">
						<tr>
							<td width="66px" class="tdColor tdC">编号</td>
							<td width="200px" class="tdColor">图片</td>
							<td width="150px" class="tdColor">药品名称</td>
							<td width="200px" class="tdColor">摘要</td>
							<td width="100px" class="tdColor">详细内容</td>
							<td width="125px" class="tdColor">操作</td>
						</tr>
						#for(x : medicinePage.getList())
						<tr>
							<td>#(x.id)</td>
							<td><div class="bsImg">
									<img src="/Weixin1#(x.img==null ? '/img/medicine_no_img.jpg' : x.img)">
								</div></td>
							<td>#(x.name)</td>
							<td style="vertical-align:middle; text-align:left;">#(x.details.length()>100?x.details.substring(0,100):x.details)......</td>
							<td><button id="#(x.id)" type="button" class="greenbutton" onclick="details(this)">查看详情</button></td>
							
							<td><a href="/Weixin1/manage/medicineEdit/#(x.id)"><img class="operation" src="/Weixin1/manage/img/update.png"></a> 
							<a href="/Weixin1/manage/medicineDelete/#(x.id)" onclick="return confirm('确认删除？')"><img class="operation delban" src="/Weixin1/manage/img/delete.png"></a></td>
						</tr>
						<tr >
							<td  colspan="6" >
								<div id="details#(x.id)" style="display:none">
								<textarea rows="20" cols="150" readonly = "readonly">#(x.details)</textarea>
								</div>
							</td>
							
						</tr>
						#end
						
					</table>
					<br></br>
					<div align="center">
						<a  type="button" class="button" href="/Weixin1/manage/preMedicinePage/#(pageNum)" onclick="return getPre()">上一页</a>
						<label >#(medicinePage.totalPage==0?0:medicinePage.pageNumber)页/#(medicinePage.totalPage)页</label>
						<a type="button" class="button" href="/Weixin1/manage/nextMedicinePage/#(pageNum)-#(totalPage)" onclick="return getNext()">下一页</a>
					</div>
					

					<input id="pageNum" type="hidden" value="#(pageNum)"></input>
					<input id="totalPage" type="hidden" value="#(totalPage)"></input>
					<script type="text/javascript">
						function getPre(){
							var pageNum = $("#pageNum").val();
							if(pageNum == 1){
								alert("当前已经是第一页！！");
								return false;
							}
							return true;

						}
						
						function getNext(){
							var pageNum = $("#pageNum").val();
							var totalPage = $("#totalPage").val();
							if(pageNum == totalPage){
								alert("当前已经是最后一页！！");
								return false;
							}
							return true;
						}
						
						function details(obj){
							
							var text = obj.innerHTML;
							if(text=="查看详情"){
								
								obj.innerHTML = "收起";
								var id = "details"+obj.id;
								document.getElementById(id).style.display="block";
								
							}else{
								obj.innerHTML = "查看详情";
								var id = "details"+obj.id;
								document.getElementById(id).style.display="none";
								
							}
								
								
						}
					</script>	
					
					<br></br>
					<br></br>
					<br></br>
					
				</div>
	
				<!-- medicine 表格 显示 end-->
			</div>
			<!-- medicine页面样式end -->
		</div>

	</div>


	
</body>


</html>